//
//  JsAnimationManager.m
//  MpaClientIos
//
//  Created by Gikki Ares on 2023/4/21.
//  Copyright © 2023 Yach. All rights reserved.
//

#import "JsAnimationManager.h"
#import "JsAnimationExecutorA.h"

@interface JsAnimationManager() {
	id<JsAnimationExecutorInterface> mExecutor;
}

@end

@implementation JsAnimationManager

+ (instancetype)sharedInstance {
	static JsAnimationManager * _sharedInstance;
	static dispatch_once_t onceToken;
	dispatch_once(&onceToken, ^{
		_sharedInstance = [[JsAnimationManager alloc]init];
	});
	return _sharedInstance;
}

-(instancetype)init {
	if(self = [super init]) {
		mExecutor = [JsAnimationExecutorA sharedInstance];
	}
	return self;
}

	//以增量式的去旋转可以达到无限旋转的效果.
	//speed为每秒旋转的角度.
	//旋转的角度最大不能超过180度,否则会朝反方向旋转.
	//每次动画实际效果为 : angle --> angle + speed.
- (void)rotateView:(UIView *)view atSpeed:(float)speed {
	[mExecutor rotateView:view atSpeed:speed];
}

-(void)shakeView:(UIView *)view withEth:(BOOL)b {
	[mExecutor shakeView:view withEth:b];
}

- (void)stopRotate:(UIView *)view {
	[mExecutor stopRotate:view];
}

@end
